package edu.lyun.stumvc.mapper;

import edu.lyun.stumvc.entity.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface StudentMapper {
    @Select("SELECT * FROM students")
    List<Student> selectAllFromStudents();
    @Delete("DELETE FROM students WHERE id=#{id}")
    int deleteStudentsWhereIdEqual(@Param("id") int id);
    @Update("UPDATE students SET name=#{student.name},sex=#{student.sex},age=#{student.age},phone=#{student.phone},tail=#{student.tail} WHERE id=#{student.id}")
    int updateStudentsByStudent(@Param("student") Student student);
    @Insert("INSERT INTO students(name,sex,age,phone,tail) VALUES (#{student.name},#{student.sex},#{student.age},#{student.phone},#{student.tail})")
    int insertIntoStudentsByStudent(@Param("student") Student student);
}
